package com.jiyun.h2303b.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiyun.h2303b.dao.TbOrderMapper;
import com.jiyun.h2303b.pojo.TbOrder;
import com.jiyun.h2303b.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImpl extends ServiceImpl<TbOrderMapper, TbOrder> implements OrderService {

    @Autowired
    private TbOrderMapper tbOrderMapper;

    @Override
    public TbOrder create(int userId, String commodityCode, int orderCount) {
        TbOrder tbOrder = new TbOrder();
        tbOrder.setUserId(userId);
        tbOrder.setCommodityCode(commodityCode);
        tbOrder.setCount(orderCount);
        tbOrder.setMoney(orderCount*1);
        tbOrderMapper.insertOrder(tbOrder);
        return null;
    }
}
